1 00:00:00,720 --> 00:00:05,910 Now let's get our animation editor going so we could put a kickback animation on our pistol. 2 00:00:05,910 --> 00:00:08,730 So when we fire it, bam, it pops up. 3 00:00:09,300 --> 00:00:11,040 That makes it look a little more realistic. 4 00:00:11,040 --> 00:00:14,970 And it's a good introduction to the animation editor, a nice, simple one. 5 00:00:16,060 --> 00:00:22,650 Click on the Avatar tab and we're going to create animations that are going to go on our players. 6 00:00:22,660 --> 00:00:26,620 We need a rig to do this, and a rig is a character. 7 00:00:26,620 --> 00:00:27,970 It's a dummy character. 8 00:00:27,970 --> 00:00:30,520 So we're going to click on Rig Builder. 9 00:00:30,520 --> 00:00:33,820 We have two choices are 15 are six. 10 00:00:33,820 --> 00:00:35,560 Let's say a quick look at each of them. 11 00:00:35,560 --> 00:00:36,730 Here's an AR 15. 12 00:00:36,730 --> 00:00:37,900 I'll pick man rig. 13 00:00:37,900 --> 00:00:41,880 You can play around with them, but that's most like my player, right? 14 00:00:41,890 --> 00:00:43,390 So there's 15 body parts. 15 00:00:43,390 --> 00:00:47,620 That's why it's called an AR 15, 15 movable body parts. 16 00:00:47,620 --> 00:00:55,300 So from your left foot down to your head, there's 15 of those 15 items, but not including the humanoid 17 00:00:55,300 --> 00:00:57,280 root part, because we're not going to animate that. 18 00:00:57,730 --> 00:00:59,950 And let's take a look at the R six. 19 00:00:59,950 --> 00:01:08,230 So if we look at our six man rig, there are six body parts that can do animation stuff, right? 20 00:01:08,230 --> 00:01:11,170 That you can move around head, not humanoid part. 21 00:01:11,170 --> 00:01:14,350 And then these five down here so. 22 00:01:15,190 --> 00:01:23,020 If you're confused on what you should use, use AR 15, because we've only been doing AR 15 up to this 23 00:01:23,020 --> 00:01:23,660 point. 24 00:01:23,680 --> 00:01:27,630 If you know our six stuff and you want to try our six, go ahead. 25 00:01:27,640 --> 00:01:31,430 If this is all new though, I recommend just following along directly. 26 00:01:31,450 --> 00:01:34,450 If we go to home. 27 00:01:34,660 --> 00:01:37,930 Right, and take a look at our game settings. 28 00:01:38,290 --> 00:01:46,600 Go to Avatar and this is how you can change what your players are going to use for their character, 29 00:01:46,600 --> 00:01:48,850 our six or our 15. 30 00:01:48,880 --> 00:01:51,090 It defaults to our 15. 31 00:01:51,100 --> 00:01:56,890 If we use player choice, we're going to have to do an animation for both of these, decide what the 32 00:01:56,890 --> 00:01:59,490 player is using and then use that animation. 33 00:01:59,500 --> 00:02:00,650 That's a little tricky. 34 00:02:00,670 --> 00:02:02,530 Let's stick with our 15. 35 00:02:04,360 --> 00:02:05,750 Go ahead and close this window. 36 00:02:05,770 --> 00:02:06,810 We're not going to change it. 37 00:02:06,820 --> 00:02:08,110 Keep it AR 15. 38 00:02:08,110 --> 00:02:11,300 And then let's go back to our Avatar tab. 39 00:02:11,320 --> 00:02:18,070 We're going to hit animation editor and we're going to get a new window if it's floating around somewhere 40 00:02:18,070 --> 00:02:20,080 weird, like like here. 41 00:02:20,470 --> 00:02:22,180 Just go ahead and move it. 42 00:02:22,180 --> 00:02:25,900 And what you want to do is move it over the section that you want. 43 00:02:25,930 --> 00:02:27,930 See, I'm on that with my mouse. 44 00:02:27,940 --> 00:02:28,360 Boom. 45 00:02:28,360 --> 00:02:29,360 It goes right there. 46 00:02:29,380 --> 00:02:30,190 Cool. 47 00:02:30,220 --> 00:02:34,020 I like to have my little guy facing to the right. 48 00:02:34,020 --> 00:02:34,340 Right. 49 00:02:34,360 --> 00:02:35,530 That's just a preference. 50 00:02:36,130 --> 00:02:39,250 It says select the rig so that you can start creating. 51 00:02:39,280 --> 00:02:47,020 We're going to click on it, and then we are going to call this animation kickback. 52 00:02:47,110 --> 00:02:47,420 Right? 53 00:02:47,440 --> 00:02:49,300 It's kickback for our pistol. 54 00:02:49,600 --> 00:02:50,830 Hit create. 55 00:02:51,070 --> 00:02:55,750 And now let's take a look at some of these options down here in the lower left corner. 56 00:02:55,750 --> 00:02:57,310 I got these three dots. 57 00:02:57,340 --> 00:03:01,720 Open this up and I'm going to show you the thing that messes most people up. 58 00:03:01,750 --> 00:03:04,000 It's animation priority. 59 00:03:04,100 --> 00:03:04,450 All right. 60 00:03:04,450 --> 00:03:10,390 And I know you can't see these bottom ones down here below Action two, but the animation priority determines 61 00:03:10,390 --> 00:03:13,090 what animations are going to play if there's a conflict. 62 00:03:13,090 --> 00:03:19,390 So Idol is like if you're standing around doing nothing that will be overtaken by movement. 63 00:03:19,390 --> 00:03:26,680 If you hit your W key and you start running right, action is going to overtake movement if there's 64 00:03:26,680 --> 00:03:27,340 a conflict. 65 00:03:27,340 --> 00:03:33,760 So if you go ahead and pick up a gun and you want to shoot, you want the action to overtake what's 66 00:03:33,760 --> 00:03:36,310 happening for the movement if there is a conflict. 67 00:03:36,310 --> 00:03:39,430 So I'm going to go action because we're going to be shooting a pistol. 68 00:03:39,430 --> 00:03:40,840 That's an action movement. 69 00:03:40,840 --> 00:03:43,600 Same with like swing and a sword, stuff like that. 70 00:03:43,720 --> 00:03:46,510 Now what I'm going to do, I'm going to hit these three dots. 71 00:03:46,510 --> 00:03:48,190 I'm going to hit save. 72 00:03:48,970 --> 00:03:50,620 And let's take a look at our dummy. 73 00:03:51,380 --> 00:03:51,730 Right. 74 00:03:51,730 --> 00:03:52,930 There's our dummy. 75 00:03:54,000 --> 00:03:59,370 If we take a look at down in here, we have a model, right? 76 00:03:59,370 --> 00:04:02,460 And inside the model we have our kickback. 77 00:04:02,820 --> 00:04:08,190 So the animation keyframes of the animation you're creating is saved here. 78 00:04:08,190 --> 00:04:11,820 If you delete your dummy, you're going to lose your animation, right? 79 00:04:11,820 --> 00:04:13,590 So don't delete your dummy until you're done. 80 00:04:13,590 --> 00:04:16,770 You polished it or you save this off someplace. 81 00:04:16,860 --> 00:04:17,250 All right. 82 00:04:17,250 --> 00:04:18,480 Now we kind of lost this. 83 00:04:18,480 --> 00:04:19,290 That's all right. 84 00:04:19,290 --> 00:04:21,030 We'll just click here to continue. 85 00:04:21,420 --> 00:04:24,030 Let's take a look at this thing right here. 86 00:04:24,030 --> 00:04:25,730 This is our timeline. 87 00:04:25,740 --> 00:04:28,260 It is in seconds frames. 88 00:04:28,260 --> 00:04:29,250 That's the units. 89 00:04:29,250 --> 00:04:31,200 So this is a full second. 90 00:04:31,200 --> 00:04:33,570 See how it's 100. 91 00:04:33,570 --> 00:04:35,730 So it's the next second. 92 00:04:35,730 --> 00:04:37,590 The zero frame right here. 93 00:04:37,590 --> 00:04:39,150 This is the zero frame. 94 00:04:39,150 --> 00:04:45,870 Zero second, if you want to change your timeline, maybe you're used to another type of animation editor. 95 00:04:45,870 --> 00:04:48,660 You could do that with frames or second frames. 96 00:04:48,660 --> 00:04:50,550 You only have two choices, right? 97 00:04:50,550 --> 00:04:53,040 Frame rate, 30 frames per second. 98 00:04:53,040 --> 00:04:59,670 So we're going to have a we're going to be able to animate on 30 different frames over a one second 99 00:04:59,670 --> 00:05:00,180 period. 100 00:05:00,180 --> 00:05:03,140 That should be sufficient, especially for what we're doing. 101 00:05:03,150 --> 00:05:05,670 And then we have playback speed that's relatively new. 102 00:05:05,670 --> 00:05:08,280 I was just keeping up one and I keep this at 30. 103 00:05:08,700 --> 00:05:09,060 All right. 104 00:05:09,060 --> 00:05:12,060 So now let's go ahead and do some animating. 105 00:05:12,060 --> 00:05:13,770 This is our scrubber bar. 106 00:05:13,770 --> 00:05:18,240 So wherever this is, the keyframes are going to be created. 107 00:05:18,240 --> 00:05:21,330 When we move this dummy, I'm going to click on them. 108 00:05:21,330 --> 00:05:23,940 And I got this little rotate thing here. 109 00:05:23,940 --> 00:05:28,020 If you don't have it, go ahead and click on Rotate and then you'll have it. 110 00:05:28,440 --> 00:05:36,630 I like to keep my snap grid for rotate checked and at 15 degrees if I can, sometimes I need more precise 111 00:05:36,630 --> 00:05:38,820 movement, so I'll decrease this number. 112 00:05:39,180 --> 00:05:39,420 All right. 113 00:05:39,420 --> 00:05:41,370 So I clicked this upper arm. 114 00:05:41,370 --> 00:05:42,660 I don't know if you see that. 115 00:05:42,660 --> 00:05:49,830 And this little L here means the rotate is going to be relative to the part that I'm moving. 116 00:05:49,830 --> 00:05:55,170 If I do a control L, that's relative to the global coordinate system. 117 00:05:55,350 --> 00:05:55,660 Right. 118 00:05:55,710 --> 00:06:01,470 And then you'll get better at that as we I'll explain it as I go along. 119 00:06:01,470 --> 00:06:03,810 That's a little bit hard to follow. 120 00:06:03,810 --> 00:06:04,920 So I clicked. 121 00:06:04,920 --> 00:06:06,360 I clicked that arm. 122 00:06:06,510 --> 00:06:10,350 And when we're holding a tool, the arm is up like that. 123 00:06:10,350 --> 00:06:13,200 If you've noticed that when you had your pistol, the arm went up. 124 00:06:13,200 --> 00:06:16,050 If it's a hammer or a flashlight, it's going to be the same thing. 125 00:06:16,980 --> 00:06:17,370 All right. 126 00:06:17,370 --> 00:06:20,790 When we fire, it's going to pop up. 127 00:06:20,790 --> 00:06:24,510 So I'm going to click maybe on the third frame. 128 00:06:24,510 --> 00:06:27,740 Notice how my scrubber bar moved out here. 129 00:06:27,750 --> 00:06:33,930 Now, when I move the hand up on to three, move it up 45 degrees. 130 00:06:33,930 --> 00:06:36,230 We got keyframes, right? 131 00:06:36,240 --> 00:06:37,620 These are key frames. 132 00:06:38,490 --> 00:06:42,600 If we want to see what happened at zero, make sure you don't go too far or you're going to get this 133 00:06:42,600 --> 00:06:43,710 weird thing comes up. 134 00:06:43,830 --> 00:06:46,530 Hit, cancel, go to zero. 135 00:06:46,530 --> 00:06:47,190 That's what it's at. 136 00:06:47,190 --> 00:06:47,970 Zero. 137 00:06:48,180 --> 00:06:48,990 That's what it's at. 138 00:06:48,990 --> 00:06:50,790 Three, three frames. 139 00:06:50,940 --> 00:06:52,200 Let's go to zero. 140 00:06:52,200 --> 00:06:53,250 Right click. 141 00:06:53,250 --> 00:06:54,360 Copy. 142 00:06:55,190 --> 00:06:59,300 Go out to the 15th frame, which is 0.5 seconds. 143 00:06:59,480 --> 00:06:59,740 Right. 144 00:06:59,750 --> 00:07:01,070 30 frames per second. 145 00:07:01,100 --> 00:07:02,270 I'm going to. 146 00:07:02,920 --> 00:07:04,570 Copy selected. 147 00:07:04,570 --> 00:07:05,860 Whoops, I lost it. 148 00:07:05,860 --> 00:07:07,000 Oh, that was the copy selector. 149 00:07:07,000 --> 00:07:10,420 I'm going to pay selected and paste keyframes. 150 00:07:10,420 --> 00:07:11,260 There we go. 151 00:07:11,680 --> 00:07:12,340 That's a little rough. 152 00:07:12,340 --> 00:07:13,330 I'm sorry about that. 153 00:07:13,330 --> 00:07:15,010 And now we're going to try this out. 154 00:07:15,220 --> 00:07:17,250 Boom, boom. 155 00:07:17,260 --> 00:07:18,970 That looks like it's going to work. 156 00:07:19,370 --> 00:07:21,610 All right, I'm going to hit my three dots. 157 00:07:21,760 --> 00:07:23,080 I'm going to save it again. 158 00:07:23,080 --> 00:07:24,550 And that's going to save it to the dummy. 159 00:07:24,550 --> 00:07:25,840 We're not going to use that. 160 00:07:25,840 --> 00:07:30,010 What we're going to do, hit these three dots, publish two roadblocks. 161 00:07:30,010 --> 00:07:34,810 Now you have to publish the roadblocks under your account, right? 162 00:07:34,840 --> 00:07:36,160 Or it's not going to work. 163 00:07:36,430 --> 00:07:38,050 Hit the submit button. 164 00:07:39,390 --> 00:07:40,800 And you're going to get an ID. 165 00:07:40,830 --> 00:07:44,310 Your ID is not going to match my ID if you use my ID. 166 00:07:44,340 --> 00:07:46,110 It's not going to work in your game. 167 00:07:46,110 --> 00:07:53,970 Your games need to have IDs created under your Creator ID or your game making ID, so I just copied 168 00:07:53,970 --> 00:07:55,920 that by clicking these two boxes. 169 00:07:56,430 --> 00:07:57,710 Hit close. 170 00:07:57,720 --> 00:08:02,070 If you lose it, you can go to the website and look under creations for animations. 171 00:08:02,220 --> 00:08:03,930 Then you could find the ID again. 172 00:08:03,930 --> 00:08:07,790 That's a pain, but we're not going to lose it. 173 00:08:07,800 --> 00:08:17,100 We're going to go down to our gun in our starter pack, open up the pistol, we're going to hit that 174 00:08:17,100 --> 00:08:21,450 plus sign, hit an A for animation. 175 00:08:22,640 --> 00:08:22,910 Right. 176 00:08:22,910 --> 00:08:24,650 And there's a lot of things that look like animation. 177 00:08:24,680 --> 00:08:26,450 Make sure it says animation. 178 00:08:26,630 --> 00:08:28,090 Click on animation. 179 00:08:28,100 --> 00:08:29,360 See that ID? 180 00:08:30,060 --> 00:08:31,780 Right or left? 181 00:08:31,800 --> 00:08:33,950 Yeah, right Click paste. 182 00:08:33,960 --> 00:08:35,880 Your ID just went there. 183 00:08:35,880 --> 00:08:37,560 Hit enter boom. 184 00:08:37,560 --> 00:08:41,190 And then you got this RB asset ID pre pended. 185 00:08:41,190 --> 00:08:42,630 So there you go. 186 00:08:42,630 --> 00:08:44,700 Now, we saved it off. 187 00:08:46,150 --> 00:08:48,310 So this just says animation. 188 00:08:48,310 --> 00:08:53,800 We need to make it a little more descriptive because we're going to also have a reload animation under 189 00:08:53,800 --> 00:08:57,430 and make sure you're under simple pistol just in case you don't want to lose it. 190 00:08:57,520 --> 00:09:00,580 I'm going to call this kick back and. 191 00:09:01,300 --> 00:09:01,810 All right. 192 00:09:01,810 --> 00:09:03,430 So we got our kick back in him. 193 00:09:03,430 --> 00:09:06,880 We got our ID, It's under the simple pistol. 194 00:09:06,880 --> 00:09:08,680 Let's go to the shoot script. 195 00:09:08,680 --> 00:09:09,990 Under the simple pistol. 196 00:09:10,000 --> 00:09:11,380 That's the local script. 197 00:09:11,410 --> 00:09:13,150 Get rid of that window there. 198 00:09:13,150 --> 00:09:14,500 So we have more space. 199 00:09:14,800 --> 00:09:17,920 And up in the top where we have our variable section. 200 00:09:17,920 --> 00:09:19,900 Let's go below canned shoot. 201 00:09:19,930 --> 00:09:22,150 We're going to define two variables. 202 00:09:22,150 --> 00:09:23,650 We're going to define one. 203 00:09:23,650 --> 00:09:27,130 Define one called kickback. 204 00:09:27,130 --> 00:09:33,670 And M I'll do a script dot parent colon, wait for child. 205 00:09:33,670 --> 00:09:34,540 There it is. 206 00:09:34,540 --> 00:09:37,960 Kick back in him inside speech quotes. 207 00:09:38,830 --> 00:09:42,520 I'm going to do another variable for the kick back track. 208 00:09:42,520 --> 00:09:46,300 So kick back track, this is going to be the playable track. 209 00:09:46,300 --> 00:09:47,800 So this is the animation. 210 00:09:47,800 --> 00:09:51,910 We're going to load it inside of our character and this is going to be the track variable that we're 211 00:09:51,910 --> 00:09:55,870 going to get back so we can play it, we can hit, play and stop and stuff like that. 212 00:09:56,110 --> 00:09:59,830 It's nil right now because we can't get that track yet. 213 00:09:59,830 --> 00:10:02,710 Let's go down to our on equipped. 214 00:10:02,710 --> 00:10:05,740 When we pick up the weapon, then we have a player. 215 00:10:06,100 --> 00:10:07,540 We can get the character. 216 00:10:07,540 --> 00:10:10,990 We need the character two different ways we can get it from the tool. 217 00:10:10,990 --> 00:10:16,420 Once you equip it, the parent of the tool is the character, or we can get it from the player. 218 00:10:16,420 --> 00:10:17,800 I'm going to get it from the player. 219 00:10:18,190 --> 00:10:21,520 It's just preference I'll do now. 220 00:10:21,520 --> 00:10:23,860 Player Let's think in player, right. 221 00:10:23,950 --> 00:10:26,680 I want to get the char, the character from the player. 222 00:10:26,680 --> 00:10:29,920 So I'm going to do player dot character. 223 00:10:30,040 --> 00:10:32,860 That will give me the character if it's there. 224 00:10:32,860 --> 00:10:36,370 But it could take up to 2 seconds for a character to load. 225 00:10:36,370 --> 00:10:38,230 This is a shooting game. 226 00:10:38,230 --> 00:10:42,730 We may be responding, we pick up our weapon, character's not fully complete. 227 00:10:42,820 --> 00:10:48,850 Let's do an or player dot character added. 228 00:10:49,930 --> 00:10:50,740 Wait. 229 00:10:51,280 --> 00:10:55,390 And this is going to pause the script right here until the character is added. 230 00:10:55,390 --> 00:10:59,230 We're going to wait there, then we'll have the character here. 231 00:10:59,680 --> 00:11:04,540 So once we get the character, we're going to need the humanoid local. 232 00:11:04,630 --> 00:11:10,240 We're going to get the humanoid char wait for child humanoid. 233 00:11:10,840 --> 00:11:15,160 Now, it used to be able to you can still do this, actually, you can load the animation right into 234 00:11:15,160 --> 00:11:15,760 the humanoid. 235 00:11:15,760 --> 00:11:16,840 They don't recommend it. 236 00:11:16,840 --> 00:11:22,360 They recommend using an animator or animator. 237 00:11:22,630 --> 00:11:22,860 Right. 238 00:11:23,020 --> 00:11:24,250 And that is in the humanoid. 239 00:11:24,250 --> 00:11:29,020 So humanoid wait for child animator. 240 00:11:29,650 --> 00:11:30,190 Cool. 241 00:11:30,190 --> 00:11:32,050 So if we look at our dummy real quick. 242 00:11:33,160 --> 00:11:36,650 Dummy humanoid animator. 243 00:11:36,670 --> 00:11:40,600 Now your character has an animator to some r sixes. 244 00:11:40,600 --> 00:11:47,740 Some of the R six regs maybe have the animator now, but even like within the last six months, some 245 00:11:47,740 --> 00:11:48,430 of them didn't. 246 00:11:48,430 --> 00:11:53,080 So if you're going to we're not doing anything with that now, but just be forewarned. 247 00:11:53,080 --> 00:11:55,630 But your character will definitely have an animator. 248 00:11:56,230 --> 00:11:56,500 All right. 249 00:11:56,500 --> 00:11:58,540 So then we're going to do know. 250 00:11:58,540 --> 00:12:03,850 What we're going to do is we're going to get our track, we're going to get our kickback track. 251 00:12:04,450 --> 00:12:13,450 We're going to get that when we get our animator and load the animation and we'll just go ahead and 252 00:12:13,450 --> 00:12:15,970 do our kickback animation. 253 00:12:15,970 --> 00:12:17,770 So we're going to get the animation. 254 00:12:18,520 --> 00:12:21,280 Load animation inside the animator. 255 00:12:21,370 --> 00:12:22,600 Get the track. 256 00:12:22,600 --> 00:12:24,430 We can play the track. 257 00:12:24,910 --> 00:12:25,900 We're good to go. 258 00:12:25,900 --> 00:12:32,560 So when we shoot, let's go right before we fire our motive into the server to do damage. 259 00:12:33,490 --> 00:12:37,750 Kick back track Colon play. 260 00:12:38,140 --> 00:12:38,790 Let's check. 261 00:12:38,830 --> 00:12:39,970 Let's check it out. 262 00:12:40,120 --> 00:12:41,140 Hit the play. 263 00:12:45,290 --> 00:12:47,120 And we're going to pick up our pistol. 264 00:12:47,570 --> 00:12:50,900 I want to check at the front to see if it goes straight up. 265 00:12:51,510 --> 00:12:52,220 Yep. 266 00:12:53,590 --> 00:12:54,490 Yeah. 267 00:12:55,360 --> 00:12:56,470 This is looking good.